﻿using Common.Communal;
using ERP.Domain.Processs;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Sell.Api.Read.Application.Command.ProcesssCommand;
using Sell.DTO;

namespace Sell.Api.Read.Controllers.Processs
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProcesssController : ControllerBase
    {
        public IMediator mediator { get;}
        public ProcesssController(IMediator _mediator)
        {
            mediator= _mediator;
        }
        /// <summary>
        /// 工序管理列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<processlistdto>>> Processslist([FromQuery]ProcessslistCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序分类列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public Task<ApiResult<ApiPaging<ProcessType>>> processtypelist([FromQuery]processtypelistCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 工序流程列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<ApiResult<ApiPaging<processflowdto>>> Processflowlist([FromQuery]ProcessflowCommand request)
        {
           return await mediator.Send(request);
        }
    }
}
